home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 015a / memsz160.zip / ABOUT.C next >
C/C++ Source or Header  |  1993-01-20  |  5KB  |  169 lines

  1. /******************************************************************** ABOUT.C
  2.  *                                        *
  3.  *              Generic "About" Dialog                *
  4.  *                                        *
  5.  ****************************************************************************/
  6.  
  7. #define INCL_WIN
  8. #include <os2.h>
  9.  
  10. #include "support.h"
  11. #include "about.h"
  12.  
  13.  
  14. /****************************************************************************
  15.  *                                        *
  16.  *               Definitions & Declarations                *
  17.  *                                        *
  18.  ****************************************************************************/
  19.  
  20. static METHODFUNCTION InitDlg ;
  21. static METHODFUNCTION Command ;
  22. static METHODFUNCTION OK ;
  23. static METHODFUNCTION Cancel ;
  24.  
  25.  
  26. /****************************************************************************
  27.  *                                        *
  28.  *    "About" Dialog Processor                        *
  29.  *                                        *
  30.  ****************************************************************************/
  31.  
  32. extern MRESULT EXPENTRY AboutProcessor
  33. (
  34.   HWND hwnd,
  35.   USHORT msg,
  36.   MPARAM mp1,
  37.   MPARAM mp2
  38. )
  39. {
  40.  /***************************************************************************
  41.   *                Declarations                    *
  42.   ***************************************************************************/
  43.  
  44.   static METHOD Methods [] =
  45.   {
  46.     { WM_INITDLG, InitDlg },
  47.     { WM_COMMAND, Command }
  48.   } ;
  49.  
  50.  /***************************************************************************
  51.   * Dispatch the message according to the method table and return the        *
  52.   *   result.  Any messages not defined above get handled by the system     *
  53.   *   default dialog processor.                         *
  54.   ***************************************************************************/
  55.  
  56.   return ( DispatchMessage ( hwnd, msg, mp1, mp2, Methods, sizeof(Methods)/sizeof(Methods[0]), WinDefDlgProc ) ) ;
  57. }
  58.  
  59. /****************************************************************************
  60.  *                                        *
  61.  *    Initialize Dialog                            *
  62.  *                                        *
  63.  ****************************************************************************/
  64.  
  65. static MRESULT APIENTRY InitDlg
  66.   HWND hwnd, 
  67.   USHORT msg,
  68.   MPARAM mp1, 
  69.   MPARAM mp2
  70. )
  71. {
  72.   PABOUT_PARMS Parms = (PABOUT_PARMS) ( PVOIDFROMMP ( mp2 ) ) ;
  73.  
  74.   WinSetWindowUShort ( hwnd, QWS_ID, Parms->id ) ;
  75.  
  76.   if ( Parms->hwndHelp )
  77.   {
  78.     WinAssociateHelpInstance ( Parms->hwndHelp, hwnd ) ;
  79.   }
  80.  
  81.   return ( MRFROMSHORT ( FALSE ) ) ;
  82.  
  83.   hwnd = hwnd ;  msg = msg ;  mp1 = mp1 ;  mp2 = mp2 ;
  84. }
  85.  
  86. /****************************************************************************
  87.  *                                        *
  88.  *    Process commands received by the About Dialog                *
  89.  *                                        *
  90.  ****************************************************************************/
  91.  
  92. static MRESULT APIENTRY Command
  93.   HWND hwnd, 
  94.   USHORT msg, 
  95.   MPARAM mp1, 
  96.   MPARAM mp2
  97. )
  98. {
  99.  /***************************************************************************
  100.   * Local Declarations                                *
  101.   ***************************************************************************/
  102.  
  103.   static METHOD Methods [] =
  104.   {
  105.     { DID_OK,      OK     },
  106.     { DID_CANCEL, Cancel },
  107.   } ;
  108.  
  109.  /***************************************************************************
  110.   * Dispatch the message without a default message processor.            *
  111.   ***************************************************************************/
  112.  
  113.   return ( DispatchMessage ( hwnd, SHORT1FROMMP(mp1), mp1, mp2, Methods, sizeof(Methods)/sizeof(Methods[0]), NULL ) ) ;
  114.  
  115.   hwnd = hwnd ;  msg = msg ;  mp1 = mp1 ;  mp2 = mp2 ;
  116. }
  117.  
  118. /****************************************************************************
  119.  *                                        *
  120.  *    Process the About Dialog's OK button being pressed.                 *
  121.  *                                        *
  122.  ****************************************************************************/
  123.  
  124. static MRESULT APIENTRY OK
  125.   HWND hwnd, 
  126.   USHORT msg, 
  127.   MPARAM mp1, 
  128.   MPARAM mp2
  129. )
  130. {
  131.  /***************************************************************************
  132.   * Dismiss the dialog with a TRUE status.                    *
  133.   ***************************************************************************/
  134.  
  135.   WinDismissDlg ( hwnd, TRUE ) ;
  136.  
  137.   return ( 0 ) ;
  138.  
  139.   hwnd = hwnd ;  msg = msg ;  mp1 = mp1 ;  mp2 = mp2 ;
  140. }
  141.  
  142. /****************************************************************************
  143.  *                                        *
  144.  *    Process the About Dialog's being cancelled.                         *
  145.  *                                        *
  146.  ****************************************************************************/
  147.  
  148. static MRESULT APIENTRY Cancel
  149.   HWND hwnd, 
  150.   USHORT msg, 
  151.   MPARAM mp1, 
  152.   MPARAM mp2
  153. )
  154. {
  155.  /***************************************************************************
  156.   * Dismiss the dialog with a TRUE status.                    *
  157.   ***************************************************************************/
  158.  
  159.   WinDismissDlg ( hwnd, FALSE ) ;
  160.  
  161.   return ( 0 ) ;
  162.  
  163.   hwnd = hwnd ;  msg = msg ;  mp1 = mp1 ;  mp2 = mp2 ;
  164. }
  165.